﻿
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;
using xiaodingmarket_Domain.Models;

namespace xiaodingmarket_Infra_Data.Mapping
{
    public class OrderMap : IEntityTypeConfiguration<OrderCommodity>
    {
        public void Configure(EntityTypeBuilder<OrderCommodity> builder)
        {
            builder.HasOne(p => p.OrderDetail).WithOne(p => p.orderCommodity)
               .HasForeignKey<OrderDetail>(k => k.Id)
               .OnDelete(DeleteBehavior.Cascade);//设置级联删除   
        }
    }
}
